<?php
declare(strict_types = 1);

namespace App\Controller\Chat\Ws;

use App\Constants\Chat\RedisKey;
use App\Constants\Chat\WsMessage;
use App\Controller\AbstractController;
use App\Foundation\Facades\MessageParser;
use App\Model\Auth\User;
use App\Model\Chat\FriendChatHistory;
use App\Model\Chat\GroupChatHistory;
use App\Pool\Redis;
use App\Service\Laboratory\MessageService;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\RequestMapping;

/**
 * 好友聊天控制器
 * Class FriendController
 * @package App\Controller\Chat\Ws
 * @Controller(prefix="friend",server="ws")
 */
class FriendController extends AbstractController
{


   public function search($payload=[]){
       $keyword=$payload['keyword'];
       $users=User::query()->where('username','like',$keyword.'%')->orWhere('username','like',$keyword.'%')
           ->select()->get()->toArray();
       return $users;
   }
}

